<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="chapter05.css">
    <title>动态路由参数</title>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
</head>
<body>
<div id="app">
    <h1>动态路由参数.</h1>
    <p>
        <router-link to="/user/张少平">张小三</router-link>
        <router-link to="/user/李光临">李小四</router-link>
    </p>
    <router-view></router-view>
</div>
<script>
    const user = {
        template: '<h3>我的大名叫：{{$route.params.name}}</h3>'
    };

    const router = new VueRouter({
        mode: 'history',
        routes: [
            {path: '/user/:name', component: user}
        ]
    });

    new Vue({
        el: '#app',
        router: router
    });
</script>
</body>
</html>